package com.sky.controller.admin;

import com.sky.dto.EmployeeDTO;
import com.sky.dto.EmployeePageQueryDTO;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.EmpTestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "测试员工接口")
@RequestMapping("admin/emp")
@Slf4j
public class EmpTestController {
    @Autowired
    private EmpTestService empTestService;
    //新增员工
    @PostMapping
    @ApiOperation("新增员工")
    public Result save(@RequestBody EmployeeDTO employeeDTO){
        empTestService.save(employeeDTO);
        return Result.success();
    }

    @GetMapping("/page")
    @ApiOperation("新增员工")
    public Result<PageResult> page(EmployeePageQueryDTO employeePageQueryDTO){
        PageResult pageResult= empTestService.pageQuery(employeePageQueryDTO);
        return Result.success(pageResult);
    }
}
